import axios from 'axios'
// import {closeToast} from 'vant'
const baseURL=import.meta.env.MODE==='development'?'http://162.14.108.31:3000':'http://test.com:9999'
const service=axios.create({
    baseURL,
    timeout:10000,
    

})
//请求拦截
/*service.interceptors.request.use(config=>{
    showLoadingToast({
        message:'加载中...'
        // duration:0,
    })
   
    const token='token string'
    if(token){
        config.headers.Authorization=`Bearer ${token}`
    }
    return config
},err=>{
    closeToast()
    // showNotify({type:'danger',message:'请求拦截异常：'+err.message})
    return Promise.reject(err)
})
//响应拦截
service.interceptors.response.use(
    response=>{
        closeToast()
       /*  if(response.status===200){
            const responseData=response.data
            if(responseData.code==='200'){
                return responseData.data
            }
            console.log(responseData.message)
            return Promise.reject(new Error('异常：'+ responseData.message))
        } */
     /*   return response
    },err=>{
        closeToast()
        // showNotify({type:'danger',message:'响应拦截异常'+err.message})
        return Promise.reject(err)
    }
)*/
export default service